package day9.java86;

/**
 * @author oldliu
 * @since 1.0
 */
//宠物
public abstract class Pet {
    //名字和性别
    private String name;
    private String sex;

    protected int age;
    public Pet(){
        System.out.println("pet的无参构造");
    }

    public Pet(String name, String sex) {
        this.name = name;
        this.sex = sex;
    }

    public void print(){
        System.out.println("这宠物的名字叫"+name+",性别是："+sex+",年龄是"+age+"岁");
    }
    //跑
    public abstract void run();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "宠物名字是："+name+",性别是"+sex+",年龄是"+age;
    }
}
